<template>
  <ViewZxProject ref="viewZxProjectRef" v-if="viewZxProjectVisible" />
  <ViewXjProject ref="viewXjProjectRef" v-if="viewXjProjectVisible" />
  <ViewYfProject ref="viewYfProjectRef" v-if="viewYfProjectVisible" />
  <ViewCzProject ref="viewCzProjectRef" v-if="viewCzProjectVisible" />
  <ViewSbxm ref="viewSbxmRef" v-if="viewSbxmVisible" />
</template>

<script setup>
import ViewZxProject from "@/views/project/zx/lxxm/components/ViewModal.vue";
import ViewXjProject from "@/views/project/xj/xmlx/components/ViewModal.vue";
import ViewYfProject from "@/views/project/yf/jzhtqd/components/ViewModal.vue";
import ViewCzProject from "@/views/project/yf/czhtqd/components/ViewModal.vue";
import ViewSbxm from "@/views/project/xj/sbxm/sbcl/components/ViewModal.vue";
import { ElMessage } from "element-plus";
const viewZxProjectRef = ref();
const viewXjProjectRef = ref();
const viewYfProjectRef = ref();
const viewCzProjectRef = ref();
const viewSbxmRef = ref();
const viewZxProjectVisible = ref(false);
const viewXjProjectVisible = ref(false);
const viewYfProjectVisible = ref(false);
const viewCzProjectVisible = ref(false);
const viewSbxmVisible = ref(false);
const view = (proId, proClass) => {
  if (proClass == "zXProject") {
    viewZxProjectVisible.value = true;
    nextTick(() => {
      viewZxProjectRef.value.view(proId);
    });
  } else if (proClass == "xJProject") {
    viewXjProjectVisible.value = true;
    nextTick(() => {
      viewXjProjectRef.value.view(proId);
    });
  } else if (proClass == "yfContract") {
    viewYfProjectVisible.value = true;
    nextTick(() => {
      viewYfProjectRef.value.view(proId);
    });
  } else if (proClass == "cZProject") {
    viewCzProjectVisible.value = true;
    nextTick(() => {
      viewCzProjectRef.value.view(proId);
    });
  } else if (proClass == "sbxm") {
    viewSbxmVisible.value = true;
    nextTick(() => {
      viewSbxmRef.value.view(proId);
    });
  } else {
    ElMessage({
      message: "未知的项目类型！",
      type: "error",
    });
  }
};
defineExpose({ view });
</script>

<style scoped lang="scss"></style>
